package com.bill.app.serveur;


import java.io.*;
import java.net.Socket;
import java.util.Vector;

class GroupRecption extends Thread
{

    GroupRecption(BufferedReader lecture, Vector table, Socket soc, String login, long nbr)
    {
        this.lecture = null;
        this.table = null;
        this.soc = null;
        this.nbr = 0;
        this.table = table;
        this.lecture = lecture;
        this.soc = soc;
        this.login = login+"";
        this.nbr = nbr;
        start();
    }

    public void run()
    {
        do
        {
            String mess;
			try {
				mess = lecture.readLine();
			
            if(mess.trim().compareToIgnoreCase("END") == 0)
            {
                nbr--;
                soc.close();
                Thread.yield();
                stop();
                break;
            }
            for(int i = 0; i < table.size(); i++)
			    ((PrintWriter)table.get(i)).println(mess);

			
			} catch (IOException e) {
				// TODO Auto-generated catch block
				
				break;
		
			}
        } while(true);
    }

    BufferedReader lecture;
    Vector table;
    Socket soc;
    String login;
    long nbr;
}
